home *** CD-ROM | disk | FTP | other *** search
/ C & C++ Multimedia Cyber Classroom / C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso / src / fig08_06.jar / Ch08 / Fig08_06 / Date1.h < prev    next >
C/C++ Source or Header  |  1997-10-27  |  799b  |  30 lines

  1. // Fig. 8.6: date1.h
  2. // Definition of class Date
  3. #ifndef DATE1_H
  4. #define DATE1_H
  5. #include <iostream.h>
  6.  
  7. class Date {
  8.    friend ostream &operator<<( ostream &, const Date & );
  9.  
  10. public:
  11.    Date( int m = 1, int d = 1, int y = 1900 ); // constructor
  12.    void setDate( int, int, int ); // set the date
  13.    Date &operator++();            // preincrement operator
  14.    Date operator++( int );        // postincrement operator
  15.    const Date &operator+=( int ); // add days, modify object
  16.    bool leapYear( int );          // is this a leap year?
  17.    int endOfMonth( int );         // is this end of month?
  18.  
  19. private:
  20.    int month;
  21.    int day;
  22.    int year;
  23.  
  24.    static const int days[];       // array of days per month
  25.    void helpIncrement();          // utility function
  26. };
  27.  
  28. #endif
  29.  
  30.